const express = require('express');

const app = express();
const session = require('express-session');

app.use(session({
    secret:'if(1===1){console.log("123")}',
    resave:false,
    saveUninitialized:false
}))

app.get('/set_session', (request, response)=>{
    request.session.username = 'yuonly';
    response.send('set_session');
});

app.get('/get_session', (request, response)=>{
    console.log(request.session);
    console.log(request.session.username);
    response.send('get_session');
})

app.get('/clear_session',(request, response)=>{
    request.session.destroy(()=>{
        response.send('退出登录');
    })
})

app.listen(80,()=>{
    console.log('server run at 80!');
})